home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / supbtime.c < prev    next >
C/C++ Source or Header  |  2000-05-06  |  13KB  |  404 lines

  1. /***************************************************************************
  2.  
  3.   Super Burger Time     (c) 1990 Data East Corporation (DE-0343)
  4.  
  5.   Sound:  Ym2151, Oki adpcm - NOTE!  The sound program writes to the address
  6. of a YM2203 and a 2nd Oki chip but the board does _not_ have them.  The sound
  7. program is simply the 'generic' Data East sound program unmodified for this cut
  8. down hardware (it doesn't write any good sound data btw, mostly zeros).
  9.  
  10.   This game has a few bugs:
  11.  
  12.   Some sprites clip at the edges of the screen.
  13.   Some burgers (from crushing an enemy) appear with wrong colour.
  14.   Colour cycle on title screen doesn't work first time around.
  15.  
  16.   These are NOT driver bugs!  They all exist in the original game.
  17.  
  18.   Same hardware as Tumblepop, the two drivers can be joined at a later date.
  19.  
  20.   Emulation by Bryan McPhail, mish@tendril.co.uk
  21.  
  22. ***************************************************************************/
  23.  
  24. #include "driver.h"
  25. #include "vidhrdw/generic.h"
  26. #include "cpu/h6280/h6280.h"
  27.  
  28. int  supbtime_vh_start(void);
  29. void supbtime_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  30.  
  31. WRITE_HANDLER( supbtime_pf2_data_w );
  32. WRITE_HANDLER( supbtime_pf1_data_w );
  33. READ_HANDLER( supbtime_pf1_data_r );
  34. READ_HANDLER( supbtime_pf2_data_r );
  35.  
  36. WRITE_HANDLER( supbtime_control_0_w );
  37.  
  38. extern unsigned char *supbtime_pf2_data,*supbtime_pf1_data,*supbtime_pf1_row;
  39. static unsigned char *supbtime_ram;
  40.  
  41. /******************************************************************************/
  42.  
  43. static READ_HANDLER( supbtime_controls_r )
  44. {
  45.      switch (offset)
  46.     {
  47.         case 0: /* Player 1 & Player 2 joysticks & fire buttons */
  48.             return (readinputport(0) + (readinputport(1) << 8));
  49.         case 2: /* Dips */
  50.             return (readinputport(3) + (readinputport(4) << 8));
  51.         case 8: /* Credits */
  52.             return readinputport(2);
  53.         case 10: /* ?  Not used for anything */
  54.         case 12:
  55.             return 0;
  56.     }
  57.  
  58.     logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n",cpu_get_pc(),offset);
  59.     return 0xffff;
  60. }
  61.  
  62. static WRITE_HANDLER( sound_w )
  63. {
  64.     soundlatch_w(0,data & 0xff);
  65.     cpu_cause_interrupt(1,H6280_INT_IRQ1);
  66. }
  67.  
  68. /******************************************************************************/
  69.  
  70. static struct MemoryReadAddress supbtime_readmem[] =
  71. {
  72.     { 0x000000, 0x03ffff, MRA_ROM },
  73.     { 0x100000, 0x103fff, MRA_BANK1 },
  74.     { 0x120000, 0x1207ff, MRA_BANK2 },
  75.     { 0x140000, 0x1407ff, paletteram_word_r },
  76.     { 0x180000, 0x18000f, supbtime_controls_r },
  77.     { 0x320000, 0x321fff, supbtime_pf1_data_r },
  78.     { 0x322000, 0x323fff, supbtime_pf2_data_r },
  79.     { -1 }  /* end of table */
  80. };
  81.  
  82. static struct MemoryWriteAddress supbtime_writemem[] =
  83. {
  84.     { 0x000000, 0x03ffff, MWA_ROM },
  85.     { 0x100000, 0x103fff, MWA_BANK1, &supbtime_ram },
  86.     { 0x104000, 0x11ffff, MWA_NOP }, /* Nothing there */
  87.     { 0x120000, 0x1207ff, MWA_BANK2, &spriteram },
  88.     { 0x120800, 0x13ffff, MWA_NOP }, /* Nothing there */
  89.     { 0x140000, 0x1407ff, paletteram_xxxxBBBBGGGGRRRR_word_w, &paletteram },
  90.     { 0x18000a, 0x18000d, MWA_NOP },
  91.     { 0x1a0000, 0x1a0001, sound_w },
  92.  
  93.     { 0x300000, 0x30000f, supbtime_control_0_w },
  94.     { 0x320000, 0x321fff, supbtime_pf1_data_w, &supbtime_pf1_data },
  95.     { 0x322000, 0x323fff, supbtime_pf2_data_w, &supbtime_pf2_data },
  96.  
  97.     { 0x340000, 0x3401ff, MWA_BANK3, &supbtime_pf1_row },
  98.     { 0x340400, 0x3405ff, MWA_NOP },/* Unused col scroll */
  99.     { 0x342000, 0x3421ff, MWA_NOP },/* Unused row scroll */
  100.     { 0x342400, 0x3425ff, MWA_NOP },/* Unused col scroll */
  101.     { -1 }  /* end of table */
  102. };
  103.  
  104. /******************************************************************************/
  105.  
  106. static WRITE_HANDLER( YM2151_w )
  107. {
  108.     switch (offset) {
  109.     case 0:
  110.         YM2151_register_port_0_w(0,data);
  111.         break;
  112.     case 1:
  113.         YM2151_data_port_0_w(0,data);
  114.         break;
  115.     }
  116. }
  117.  
  118. /* Physical memory map (21 bits) */
  119. static struct MemoryReadAddress sound_readmem[] =
  120. {
  121.     { 0x000000, 0x00ffff, MRA_ROM },
  122.     { 0x100000, 0x100001, MRA_NOP },
  123.     { 0x110000, 0x110001, YM2151_status_port_0_r },
  124.     { 0x120000, 0x120001, OKIM6295_status_0_r },
  125.     { 0x130000, 0x130001, MRA_NOP }, /* This board only has 1 oki chip */
  126.     { 0x140000, 0x140001, soundlatch_r },
  127.     { 0x1f0000, 0x1f1fff, MRA_BANK8 },
  128.     { -1 }  /* end of table */
  129. };
  130.  
  131. static struct MemoryWriteAddress sound_writemem[] =
  132. {
  133.     { 0x000000, 0x00ffff, MWA_ROM },
  134.     { 0x100000, 0x100001, MWA_NOP }, /* YM2203 - this board doesn't have one */
  135.     { 0x110000, 0x110001, YM2151_w },
  136.     { 0x120000, 0x120001, OKIM6295_data_0_w },
  137.     { 0x130000, 0x130001, MWA_NOP },
  138.     { 0x1f0000, 0x1f1fff, MWA_BANK8 },
  139.     { 0x1fec00, 0x1fec01, H6280_timer_w },
  140.     { 0x1ff402, 0x1ff403, H6280_irq_status_w },
  141.     { -1 }  /* end of table */
  142. };
  143.  
  144. /******************************************************************************/
  145.  
  146. INPUT_PORTS_START( supbtime )
  147.     PORT_START    /* Player 1 controls */
  148.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  149.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  150.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  151.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  152.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  153.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  154.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 - unused */
  155.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
  156.  
  157.     PORT_START    /* Player 2 controls */
  158.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  159.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  160.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  161.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  162.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  163.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  164.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 - unused */
  165.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  166.  
  167.     PORT_START    /* Credits */
  168.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  169.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  170.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  171.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK )
  172.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  173.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  174.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  175.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  176.  
  177.     PORT_START    /* Dip switch bank 1 - inverted with respect to other Deco games */
  178.     PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) )
  179.     PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
  180.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  181.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
  182.     PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
  183.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
  184.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
  185.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_5C ) )
  186.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_6C ) )
  187.     PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) )
  188.     PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
  189.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  190.     PORT_DIPSETTING(    0x1c, DEF_STR( 1C_1C ) )
  191.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
  192.     PORT_DIPSETTING(    0x14, DEF_STR( 1C_3C ) )
  193.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
  194.     PORT_DIPSETTING(    0x18, DEF_STR( 1C_5C ) )
  195.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_6C ) )
  196.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
  197.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  198.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  199.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
  200.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  201.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  202.  
  203.     PORT_START    /* Dip switch bank 2 */
  204.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
  205.     PORT_DIPSETTING(    0x80, "1" )
  206.     PORT_DIPSETTING(    0x00, "2" )
  207.     PORT_DIPSETTING(    0xc0, "3" )
  208.     PORT_DIPSETTING(    0x40, "4" )
  209.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
  210.     PORT_DIPSETTING(    0x10, "Easy" )
  211.     PORT_DIPSETTING(    0x30, "Normal" )
  212.     PORT_DIPSETTING(    0x20, "Hard" )
  213.     PORT_DIPSETTING(    0x00, "Hardest" )
  214.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
  215.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  216.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  217.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
  218.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  219.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  220.     PORT_DIPNAME( 0x02, 0x02, "Allow Continue" )
  221.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  222.     PORT_DIPSETTING(    0x02, DEF_STR( Yes ) )
  223.       PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  224.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  225.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  226. INPUT_PORTS_END
  227.  
  228. /******************************************************************************/
  229.  
  230. static struct GfxLayout charlayout =
  231. {
  232.     8,8,    /* 8*8 chars */
  233.     4096,
  234.     4,        /* 4 bits per pixel  */
  235.     { 0x40000*8+8, 0x40000*8, 8, 0 },
  236.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  237.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  238.     16*8    /* every char takes 8 consecutive bytes */
  239. };
  240.  
  241. static struct GfxLayout tile_layout =
  242. {
  243.     16,16,
  244.     4096,
  245.     4,
  246.     { 0x40000*8+8, 0x40000*8, 8, 0 },
  247.     { 32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7,
  248.         0, 1, 2, 3, 4, 5, 6, 7 },
  249.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  250.             8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  251.     64*8
  252. };
  253.  
  254. static struct GfxLayout sprite_layout =
  255. {
  256.     16,16,
  257.     4096*2,
  258.     4,
  259.     { 8, 0, 0x80000*8+8, 0x80000*8 },
  260.     { 32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7,
  261.         0, 1, 2, 3, 4, 5, 6, 7 },
  262.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  263.             8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  264.     64*8
  265. };
  266.  
  267. static struct GfxDecodeInfo gfxdecodeinfo[] =
  268. {
  269.     { REGION_GFX1, 0, &charlayout,   256, 16 },    /* Characters 8x8 */
  270.     { REGION_GFX1, 0, &tile_layout,  512, 16 },    /* Tiles 16x16 */
  271.     { REGION_GFX2, 0, &sprite_layout,  0, 16 },    /* Sprites 16x16 */
  272.     { -1 } /* end of array */
  273. };
  274.  
  275. /******************************************************************************/
  276.  
  277. static struct OKIM6295interface okim6295_interface =
  278. {
  279.     1,          /* 1 chip */
  280.     { 7757 },    /* Frequency */
  281.     { REGION_SOUND1 },    /* memory region */
  282.     { 50 }
  283. };
  284.  
  285. static void sound_irq(int state)
  286. {
  287.     cpu_set_irq_line(1,1,state); /* IRQ 2 */
  288. }
  289.  
  290. static struct YM2151interface ym2151_interface =
  291. {
  292.     1,
  293.     32220000/9, /* May not be correct, there is another crystal near the ym2151 */
  294.     { YM3012_VOL(45,MIXER_PAN_LEFT,45,MIXER_PAN_RIGHT) },
  295.     { sound_irq }
  296. };
  297.  
  298. static struct MachineDriver machine_driver_supbtime =
  299. {
  300.     /* basic machine hardware */
  301.     {
  302.          {
  303.             CPU_M68000,
  304.             14000000,
  305.             supbtime_readmem,supbtime_writemem,0,0,
  306.             m68_level6_irq,1
  307.         },
  308.         {
  309.             CPU_H6280 | CPU_AUDIO_CPU, /* Custom chip 45 */
  310.             32220000/8, /* Audio section crystal is 32.220 MHz */
  311.             sound_readmem,sound_writemem,0,0,
  312.             ignore_interrupt,0
  313.         }
  314.     },
  315.     58, 529,
  316.     1,
  317.     0,
  318.  
  319.     /* video hardware */
  320.     40*8, 32*8, { 0*8, 40*8-1, 1*8, 31*8-1 },
  321.  
  322.     gfxdecodeinfo,
  323.     1024, 1024,
  324.     0,
  325.  
  326.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK,
  327.     0,
  328.     supbtime_vh_start,
  329.     0,
  330.     supbtime_vh_screenrefresh,
  331.  
  332.     /* sound hardware */
  333.     0,0,0,0,
  334.       {
  335.         {
  336.             SOUND_YM2151,
  337.             &ym2151_interface
  338.         },
  339.         {
  340.             SOUND_OKIM6295,
  341.             &okim6295_interface
  342.         }
  343.     }
  344. };
  345.  
  346. /******************************************************************************/
  347.  
  348. ROM_START( supbtime )
  349.     ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
  350.     ROM_LOAD_EVEN( "gk03", 0x00000, 0x20000, 0xaeaeed61 )
  351.     ROM_LOAD_ODD ( "gk04", 0x00000, 0x20000, 0x2bc5a4eb )
  352.  
  353.     ROM_REGION( 0x10000, REGION_CPU2 )    /* Sound CPU */
  354.     ROM_LOAD( "gc06.bin",    0x00000, 0x10000, 0xe0e6c0f4 )
  355.  
  356.     ROM_REGION( 0x080000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  357.     ROM_LOAD( "mae02.bin", 0x000000, 0x80000, 0xa715cca0 ) /* chars */
  358.  
  359.     ROM_REGION( 0x100000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  360.       ROM_LOAD( "mae00.bin", 0x000000, 0x80000, 0x30043094 ) /* sprites */
  361.     ROM_LOAD( "mae01.bin", 0x080000, 0x80000, 0x434af3fb )
  362.  
  363.     ROM_REGION( 0x20000, REGION_SOUND1 )    /* ADPCM samples */
  364.       ROM_LOAD( "gc05.bin",    0x00000, 0x20000, 0x2f2246ff )
  365. ROM_END
  366.  
  367. ROM_START( supbtimj )
  368.     ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
  369.     ROM_LOAD_EVEN( "gc03.bin", 0x00000, 0x20000, 0xb5621f6a )
  370.     ROM_LOAD_ODD ( "gc04.bin", 0x00000, 0x20000, 0x551b2a0c )
  371.  
  372.     ROM_REGION( 0x10000, REGION_CPU2 )    /* Sound CPU */
  373.     ROM_LOAD( "gc06.bin",    0x00000, 0x10000, 0xe0e6c0f4 )
  374.  
  375.     ROM_REGION( 0x080000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  376.     ROM_LOAD( "mae02.bin", 0x000000, 0x80000, 0xa715cca0 ) /* chars */
  377.  
  378.     ROM_REGION( 0x100000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  379.       ROM_LOAD( "mae00.bin", 0x000000, 0x80000, 0x30043094 ) /* sprites */
  380.     ROM_LOAD( "mae01.bin", 0x080000, 0x80000, 0x434af3fb )
  381.  
  382.     ROM_REGION( 0x20000, REGION_SOUND1 )    /* ADPCM samples */
  383.       ROM_LOAD( "gc05.bin",    0x00000, 0x20000, 0x2f2246ff )
  384. ROM_END
  385.  
  386. /******************************************************************************/
  387.  
  388. static READ_HANDLER( supbtime_cycle_r )
  389. {
  390.     if (cpu_get_pc()==0x7e2 && READ_WORD(&supbtime_ram[0])==0) {cpu_spinuntil_int(); return 1;}
  391.  
  392.     return READ_WORD(&supbtime_ram[0]);
  393. }
  394.  
  395. static void init_supbtime(void)
  396. {
  397.     install_mem_read_handler(0, 0x100000, 0x100001, supbtime_cycle_r);
  398. }
  399.  
  400. /******************************************************************************/
  401.  
  402. GAME( 1990, supbtime, 0,        supbtime, supbtime, supbtime, ROT0, "Data East Corporation", "Super Burger Time (World)" )
  403. GAME( 1990, supbtimj, supbtime, supbtime, supbtime, supbtime, ROT0, "Data East Corporation", "Super Burger Time (Japan)" )
  404.